package com.chf.control;

import com.chf.Bean.UserInfoBean;
import com.chf.model.MyModel;
import com.chf.utils.MyUtils;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.Date;
import java.util.List;

@WebServlet(name = "UserInfoSelectServlet", value = "/UserInfoSelectServlet")
public class UserInfoSelectServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        UserInfoBean userInfoBean = MyUtils.GetClass(UserInfoBean.class);
        userInfoBean.setUserName(req.getParameter("userName"));
        userInfoBean.setUserTel(req.getParameter("userTel"));
        userInfoBean.setUserBirthday(MyUtils.StrConverDate(req.getParameter("userRegisteDate"),"yyyy-MM-dd"));
        userInfoBean.setUserBirthday2(MyUtils.StrConverDate(req.getParameter("userRegisteDate2"),"yyyy-MM-dd"));

        List<UserInfoBean> list = MyModel.SeleteUserInfo(userInfoBean);
        req.getSession().setAttribute("UserList",list);

        req.getRequestDispatcher("WEB-INF/viewpages/userInfoB/SelectAllUserInfo.jsp").forward(req,resp);
    }
}
